package com.study.modules.saas.repository.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.study.excel.easyexcel.model.ProductExcelModel;
import com.study.modules.saas.repository.model.ProductDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author hupengming
 * @ClassName
 * @Date 2022-11-01 11:17
 * @Version 1.0
 */
@Mapper
public interface ProductDao extends BaseMapper<ProductDO> {


    @Insert("<script>insert into product(name,price,manufacturer) values" +
            "<foreach collection = 'products' item = 'item' index = 'index' separator = ','>" +
            "(#{item.name},#{item.price},#{item.manufacturer})</foreach></script>")
    int addProduct(@Param("products") List<ProductExcelModel> productDOS);


}
